define(function(require, exports, module){
	var myfocusTemp = require("text!../template/certifiedEnterprise.html");

	module.exports = Nuui.View.extend({

		template:myfocusTemp,

		onRender:function(){
			var view = this;
			
			var queryMyFocusList=function(){
				App.request(App.server.getServePath(App.path.enterpriseAction), {
				//data:"",
				success:function(data){

					if(data.ec){
						alert(data.em);
						
					}else{
						var res=data.brandInfo;
						view.$(".smart-content").empty();
						for(var i=0;i< res.length;i++){
							var html='';
							html+='';
							html+='<li data-id="'+res[i].id+'">';
							html+='	<div class="part-left">';
							html+='		<img src="../../../images/img/'+res[i].img+'" alt="" />';
							html+='	</div>';
							html+='	<div class="part-right">';
							html+='		<h2 class="title">'+res[i].title+'</h2>';
							html+='		<div class="mid">';
							html+='			<div class="legal left " style="width: 27%;"> <i></i><span>'+res[i].legal+'</span></div>';
							html+='			<div class="fund left" style="width: 27%;"><i></i><span>'+res[i].registeredFunds+'</span></div>';
							html+='			<div class="date left" style="width: 45%;"><i></i><span>'+res[i].registeredDate+'</span></div>';
							html+='		</div>';
							html+='		<div class="business bottom">';
							html+='			<span style="color:#bb3b48;">主营业务：</span><span>'+res[i].business+'</span>';
							html+='		</div>';
							html+='	</div>';
							html+='</li>';
							view.$("#myFocusList").append(html);
						}
						
						// $(".avatar img").attr("src",userInfo.photo);
					}
				}
				});
			}
			
			queryMyFocusList();
			var photo = App.storage.get("photo");
			if(photo){
				this.$(".avatar img").attr("src", "data:image/png;base64," + photo);
			}
		},

		onShow:function(){
          var view=this;
          view.$('.smart-content').on('tap','li',function(){
        	  var targetId=$(this).attr('data-id');
        	  sessionStorage.setItem("key",targetId);
				App.navigate("example/index/productService", true);
			})
			
		},

		getPhoto:function(data){
			App.storage.set("photo", data.Photo);
			this.$(".avatar img").attr("src", "data:image/png;base64," + data.Photo);
		}
	});
});
